package com.stevenmoon.csdnplus.logic;

import com.google.gson.reflect.TypeToken;
import com.stevenmoon.csdnplus.app.Constants;
import com.stevenmoon.csdnplus.bean.CsdnIdentity;
import com.stevenmoon.csdnplus.bean.FavoriteListInfo;
import com.stevenmoon.csdnplus.bean.FavoriteListReqBean;
import com.stevenmoon.csdnplus.bean.FollowOperationInfo;
import com.stevenmoon.csdnplus.bean.FollowOperationReqBean;
import com.stevenmoon.csdnplus.bean.RankScoreChannel;
import com.stevenmoon.csdnplus.bean.ResponseResultBean;
import com.stevenmoon.csdnplus.bean.UserDetails;
import com.stevenmoon.csdnplus.bean.UserProfileReqBean;
import com.stevenmoon.csdnplus.net.RequestParams;
import com.stevenmoon.csdnplus.net.RxNet;
import com.stevenmoon.csdnplus.util.GsonUtil;

import rx.Observable;

/**
 * Created by WangJun on 2016/4/15.
 */
public class ProfileManager {

    public static Observable<UserDetails> getUserDetailInfo(UserProfileReqBean reqBean){
        RequestParams rp = new RequestParams(Constants.CSDNURL.USER_PROFILE, GsonUtil.convertBean2Map(reqBean));
        return RxNet.getAndFetchEntity(rp,new TypeToken<ResponseResultBean<UserDetails>>(){});
    }

    public static Observable<RankScoreChannel> getUC(String username){
        RequestParams rp = new RequestParams(Constants.CSDNURL.UC);
        rp.put("username",username);
        return RxNet.getAndFetchEntity(rp,new TypeToken<ResponseResultBean<RankScoreChannel>>(){});
    }

    public static Observable<CsdnIdentity> getUserIdentity(String username){
        RequestParams rp = new RequestParams(Constants.CSDNURL.USER_IDENTITY);
        rp.put("username",username);
        return RxNet.getAndFetchEntity(rp,new TypeToken<ResponseResultBean<CsdnIdentity>>(){});
    }

    public static Observable<FavoriteListInfo> getFavoriteList(FavoriteListReqBean reqBean){
        RequestParams rp = new RequestParams(Constants.CSDNURL.FAVORITE_LIST, GsonUtil.convertBean2Map(reqBean));
        return RxNet.getAndFetchEntity(rp,new TypeToken<ResponseResultBean<FavoriteListInfo>>(){});
    }



}
